﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using ExamDemo.Models;

namespace ExamDemo.Data
{
    public class DataInitlizer : DropCreateDatabaseIfModelChanges<ExamDemoDb>
    {
        protected override void Seed(ExamDemoDb db)
        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="admin",
                    Password="123"
                },new Users
                {
                    Username="胖胖不吃肉丸",
                    Password="123"
                },new Users
                {
                    Username="榕榕猪",
                    Password="123"
                },new Users
                {
                    Username="小胖子",
                    Password="123"
                },new Users
                {
                    Username="大胖子",
                    Password="123"
                }
            });
            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="要考试惹，烦恼"
                },new Messages
                {
                    FromUserId=2,
                    Content="我滴宝，我什么都能抗，就是扛不住想你呀"
                },new Messages
                {
                    FromUserId=3,
                    Content="笑死，根本不慌"
                },new Messages
                {
                    FromUserId=4,
                    Content="狗头给你打掉"
                },new Messages
                {
                    FromUserId=5,
                    Content="我太胖了怎么办，呜呜呜"
                }
            });
            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    MsgId=2,
                    Comment="工友说我太能抗了"
                },new Comments
                {
                    FromUserId=4,
                    MsgId=5,
                    Comment="减肥吧"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=2,
                    Comment="俺也是"
                },new Comments
                {
                    FromUserId=2,
                    MsgId=4,
                    Comment="来啊打架啊"
                },new Comments
                {
                    FromUserId=5,
                    MsgId=1,
                    Comment="别让烦恼牵引你的脚步"
                },
            });

            db.SaveChanges();

            base.Seed(db);
        }
    }
}